package com.lqk.demo.jmm.exercise;

/**
 * @author lqk
 * @date 2021/12/28 20:32
 */
public class Singleton3 {
    private Singleton3() { }
    private static Singleton3 INSTANCE = null;
    /*
        分析这里的线程安全, 并说明有什么缺点
            性能不好，只要进来就会调用 synchronized
     */
    public static synchronized Singleton3 getInstance() {
        if( INSTANCE != null ){
            return INSTANCE;
        }
        INSTANCE = new Singleton3();
        return INSTANCE;
    }
}
